/*
 * @Author: miteng 973203639@qq.com
 * @Date: 2023-12-21 09:19:21
 * @LastEditors: miteng 973203639@qq.com
 * @LastEditTime: 2024-07-12 14:46:59
 * @Description: 
 * Copyright (c) 2024-present HBIS Digital Technology Co.,Ltd. All rights reserved. 
 */
import { default as request, cloud } from '@/framework/utils/request'
import { ThemeManageListType, ThemeFromDataType, IdType } from './types';
import { ResultData, ResultDataList } from '@/framework/api/common';

// 查询主题列表
export function pageList(params: ThemeManageListType): Promise<ResultDataList<ThemeManageListType>> {
  return request({
    url: cloud.dqBasic + '/theme/pageList',
    method: 'get',
    params
  })
}
// 查询主题详情
export function detail(params: IdType): Promise<ResultData<ThemeManageListType>> {
  return request({
    url: cloud.dqBasic + '/theme/detail',
    method: 'get',
    params
  })
}

// 新增主题
export function handleAdd(data: ThemeFromDataType): Promise<ResultData<null>> {
  return request({
    url: cloud.dqBasic + '/theme/add',
    method: 'post',
    data
  });
}

// 修改主题
export function handleEdit(data: ThemeFromDataType & IdType): Promise<ResultData<null>> {
  return request({
    url: cloud.dqBasic + '/theme/edit',
    method: 'post',
    data
  });
}

// 删除主题
export function handleDelete(params: IdType): Promise<ResultData<null>> {
  return request({
    url: cloud.dqBasic + '/theme/del',
    method: 'get',
    params
  });
}

// 更新状态
export function updateStatus(data: Partial<ThemeManageListType>): Promise<ResultData<null>> {
  return request({
    url: cloud.dqBasic + '/theme/updateStatus',
    method: 'post',
    data
  });
}
// 获取当前主题
export function currentThemeInfo(): Promise<ResultData<ThemeManageListType>> {
  return request({
    url: cloud.dqBasic + '/themeApi/currentThemeInfo',
    method: 'get',
  })
}